package com.wj.blog.service.impl;

import com.wj.blog.mapper.MusicMapper;
import com.wj.blog.pojo.Music;
import com.wj.blog.service.AboutService;
import com.wj.blog.service.MusicService;
import com.wj.blog.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:   wj
 * Date:     2020/4/9 15:20
 * Description:
 */
@Service
public class MusicServiceImpl implements MusicService {

    @Autowired
    MusicMapper musicMapper;

    @Override
    public void save(Music music) {
        musicMapper.save(music);
    }

    @Override
    public void delete(Integer id) {
        musicMapper.delete(id);
    }

    @Override
    public void update(Music music) {
        musicMapper.update(music);
    }

    @Override
    public Music getById(Integer id) {
        return musicMapper.getById(id);
    }

    @Override
    public List<Music> getByPage(Page<Music> page) {
        page.setTotalCount(musicMapper.getCount(page));
        return musicMapper.getByPage(page);
    }

    @Override
    public Integer getCount(Page<Music> page) {
        return musicMapper.getCount(page);
    }

    @Override
    public List<Music> getList(Page<Music> page) {
        return musicMapper.getList(page);
    }
}
